Deflection of electrons by magnetic fields